package homework;

import org.junit.Test;

import java.util.Arrays;

public class Cardplayer {

    @Test
    public void test02() {

        Player[] players = new Player[3];
        players[0] = new Player("张飞");
        players[1] = new Player("关羽");
        players[2] = new Player("刘备");
        Card[] cards = newCards();
        for (int i = 0; i < cards.length; i++) {
            players[i % 3].addCard(cards[i]);
        }

        for (Player p : players) {
            System.out.println(p);
        }
    }

    public Card[] newCards() {
        Card[] cards = new Card[54];
        int index = 0;
        for (int rank = Card.RANK_3; rank <= Card.RANK_2; rank++) {
            for (int suit = Card.SUIT_HEITAO; suit <= Card.SUIT_FANGKUAI; suit++) {
                cards[index++] = new Card(suit, rank);
            }
        }
        cards[index++] = new Card(Card.SUIT_NULL, Card.RANK_joker);
        cards[index++] = new Card(Card.SUIT_NULL, Card.RANK_joker_2);


        return cards;
    }
    }